package com.db.serialize.serializer;

import com.db.serialize.domain.SensorData;
import com.thoughtworks.xstream.XStream;

public class XmlSensorDataSerializer implements SensorDataSerializer {
    private XStream xStream;

    public XmlSensorDataSerializer() {
        xStream = new XStream();
    }

    @Override
    public Object serialize(SensorData sensorData) {
        return xStream.toXML(sensorData);
    }

    @Override
    public SensorData deSerialize(Object data) {
        return (SensorData) xStream.fromXML((String) data);
    }
}
